{%- set default_cable = '5m' %}

{%- macro generate_port_lists(PORT_ALL) %}
    {# Generate list of ports #}
    {%- for port_idx in range(0,192,4) %}
        {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
    {%- endfor %}
{%- endmacro %}

{%- macro generate_buffer_pool_and_profiles() %}
    "BUFFER_POOL": {
        "ingress_lossless_pool": {
            "size": "3220805000",
            "type": "both",
            "mode": "dynamic",
            "xoff": "2102272"
        }
    },
    "BUFFER_PROFILE": {
        "ingress_lossless_profile": {
            "pool":"ingress_lossless_pool",
            "size":"1280",
            "dynamic_th":"-2",
            "xon_offset":"2560",
            "xon":"0",
            "xoff":"66048"
        },
        "ingress_lossy_profile": {
            "pool":"ingress_lossless_pool",
            "size":"0",
            "xon_offset":"0",
            "static_th":"30535680"
        },
        "egress_lossless_profile": {
            "pool":"ingress_lossless_pool",
            "size":"0",
            "static_th":"33030144"
        },
        "egress_lossy_profile": {
            "pool":"ingress_lossless_pool",
            "size":"0",
            "dynamic_th":"-1"
        }
    },
{%- endmacro %}

{%- macro generate_queue_buffers(port_names) %}
    "BUFFER_QUEUE": {
{% for port in port_names.split(',') %}
        "{{ port }}|3-4": {
            "profile" : "ingress_lossless_profile"
        },
{% endfor %}
{% for port in port_names.split(',') %}
        "{{ port }}|0-2": {
            "profile" : "egress_lossy_profile"
        },
{% endfor %}
{% for port in port_names.split(',') %}
        "{{ port }}|5-6": {
            "profile" : "egress_lossy_profile"
        }{% if not loop.last %},{% endif %}
{% endfor %}   
    }
{%- endmacro %}
